﻿<Sidebar Data="@sidebarInfo" />

@using Microsoft.AspNetCore.Hosting
@using Microsoft.Extensions.Hosting

@inject IWebHostEnvironment env

@code{
    Sidebar sidebar;
    
    SidebarInfo sidebarInfo = new SidebarInfo
    {
        Brand = new SidebarBrandInfo
        {
            Text = "Puppy Scheduler"
        },
        Items = new List<SidebarItemInfo>
        {
            new SidebarItemInfo 
            { 
                To = "", 
                Text = "系统首页",
                Icon = IconName.Home
            },
            new SidebarItemInfo
            {
                To = "application",
                Text = "应用管理",
                Icon = IconName.Bell,
            },
            new SidebarItemInfo
            {
                To = "job",
                Text = "任务管理",
                Icon = IconName.Book,
            },
            new SidebarItemInfo
            {
                To = "instance",
                Text = "任务实例",
                Icon = IconName.Frown,
            },
        }
    };

    protected override Task OnInitializedAsync()
    {
        if (env.IsDevelopment())
        {
            sidebarInfo.Items.Add(new SidebarItemInfo
            {
                To = "viewconfig",
                Text = "配置信息",
                Icon = IconName.Spa,
            });
        }
        
        return base.OnInitializedAsync();
    }
}